#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main()
{
    int n = 0;
    scanf("%d", &n);
    char ch[2 * n][11];
    int arr[n];
    int i = 0;
    for (i = 0; i < 2 * n; i += 2)
    {
        scanf("%s%s%d", ch[i], ch[i + 1], &arr[i / 2]);
    }
    int max = 0, max_s = 0;
    int min = 100, min_s = 0;
    for (i = 0; i < n; i++)
    {
        if (max < arr[i])
        {
            max = arr[i];
            max_s = 2 * i;
        }
        if (min > arr[i])
        {
            min = arr[i];
            min_s = 2 * i;
        }
    }
    printf("%s %s\n", ch[max_s], ch[max_s + 1]);
    printf("%s %s\n", ch[min_s], ch[min_s + 1]);
    return 0;
}
#include<stdio.h>

int main()
{
    int n = 0;
    scanf("%d", &n);
    long arr[n][3];
    int i = 0;
    int j = 0;
    for (i = 0; i < n; i++)
    {
        scanf("%ld %ld %ld", &arr[i][0], &arr[i][1], &arr[i][2]);
    }
    for (i = 0; i < n; i++)
    {
        if (arr[i][0] + arr[i][1] > arr[i][2])
        {
            printf("Case #%d: true\n", i + 1);
        }
        else
        {
            printf("Case #%d: false\n", i + 1);
        }
    }
    return 0;
}